﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Twi.COMMON.Core
{
    public class TwiDateHelper
    {
        /// <summary>
        /// 获取中文中星期几（或周几）
        /// </summary>
        /// <param name="dayOfWeek"></param>
        /// <param name="prefix">星期/周</param>
        /// <returns></returns>
        public static string GetCNDayOfWeek(DayOfWeek dayOfWeek,string prefix="星期")
        {
            string strReturn ="";
            switch (dayOfWeek)
            {
                case DayOfWeek.Monday:
                    strReturn = prefix+"一";
                    break;
                case DayOfWeek.Tuesday:
                    strReturn = prefix+"二";
                    break;
                case DayOfWeek.Wednesday:
                    strReturn = prefix+"三";
                    break;
                case DayOfWeek.Thursday:
                    strReturn = prefix+"四";
                    break;
                case DayOfWeek.Friday:
                    strReturn = prefix+"五";
                    break;
                case DayOfWeek.Saturday:
                    strReturn = prefix+"六";
                    break;
                case DayOfWeek.Sunday:
                    if (prefix=="星期")
                    {
                        strReturn = prefix + "天";
                    }
                    else if (prefix == "周")
                    {
                        strReturn = prefix + "日";
                    }
                    else
                    {
                        strReturn = prefix + "天";
                    }
                    break;
                default:
                    break;
            }
            return strReturn;
        }


        /// <summary>
        /// 获取当前日期+时间 （默认格式yyyy-MM-dd HH:mm:ss）
        /// </summary>
        /// <param name="strFormart"></param>
        /// <returns></returns>
        public static string GetNowDateTime(string strFormart = "yyyy-MM-dd HH:mm:ss")
        {
            return DateTime.Now.ToString(strFormart);
        }
    }
}
